--This script will change the format and the appearance of a manually typed fraction.
--It substitutes a non-breaking fraction slash for a standard slash,
--then changes the numerator to a superscript character and the
--denominator to a subscript character.
--To run the script, type a fraction like 2/3.
--Insert the text cursor just to the right of the fraction (do not highlight the fraction)
--Choose "Run Script..." from the “Aldus Additions” menu, select "Fraction.Script, "
--and click on the “Run File” button.
--Begin Script--
--selects and reformats numerator by making it a superscript character and adjusting the size and position.
textselect -word
typeoptions 80,58,33,0 --sets the type options for small caps and super/subscript.
--80=80% of type size for small caps size, 58=58% of type size for super/subscript size, 33=33% of type size above baseline, 0=0% below the baseline for subscript
--The above values can be adjusted for better output with different type faces
position subscript -- sets the denominator to subscript
textcursor -char
textselect +char --selects regular slash (/)
textenter "⁄" --replaces / with option-shift-1 slash
--Selects and reformats numerator
textcursor -char
textselect -word
typeoptions 80,58,33,0 --see same command above
position superscript --sets the numerator to superscript
--Leave the cursor where you started, ready to resume typing.
textcursor +word
textcursor +word
position normal --ensures that next characters entered at this position will be in the normal position